import pygame
from random import *
from commonModule import *

# 炸弹补给包


class BombSupplay(pygame.sprite.Sprite):
    def __init__(self, bg_size):
        pygame.sprite.Sprite.__init__(self)
        self.image = loadImage("bomb_supply.png")
        self.rect = self.image.get_rect()
        self.width, self.height = bg_size
        self.rect.left = randint(0, self.width - self.rect.width)
        self.rect.top = - 100
        self.active = False
        self.speed = 5
        self.mask = pygame.mask.from_surface(self.image)

    def move(self):
        self.rect.top += self.speed
        if self.rect.top > self.height:
            self.active = False

    def reset(self):
        self.active = True
        self.rect.left = randint(0, self.width - self.rect.width)
        self.rect.top = - 100

# 超级子弹补给包


class BulletSupplay(pygame.sprite.Sprite):
    def __init__(self, bg_size):
        pygame.sprite.Sprite.__init__(self)
        self.image = loadImage("bullet_supply.png")
        self.rect = self.image.get_rect()
        self.width, self.height = bg_size
        self.rect.left = randint(0, self.width - self.rect.width)
        self.rect.top = - 100
        self.active = False
        self.speed = 5
        self.mask = pygame.mask.from_surface(self.image)

    def move(self):
        self.rect.top += self.speed
        if self.rect.top > self.height:
            self.active = False

    def reset(self):
        self.active = True
        self.rect.left = randint(0, self.width - self.rect.width)
        self.rect.top = - 100
